There is a tens of millions of-record table on MySQL 5.0.x, which now reads about 1 billion of the records. Common methods, followed by loops:
1
The code is as follows
Copy Code
SELECT * FROM mytable where index_col =
Continue to consult the mysql Query statement: multi-table joint query, how to limit the right table if there is a corresponding record, then add a specific where limit or limit, otherwise there is no limit, as shown in the question
6 Table join
View table-related commands- 查看表结构 desc 表名- 查看生成表的SQL show create table 表名- 查看索引 show index from 表名Using indexes and not using indexes由于索引是专门用于加速搜索而生,所以加上索引之后,查询效率会快到飞起来。# 有索引Mysql>Select* fromTb1whereName ='Zhangqiye';+-----+-------------+---
Continue to consult the mysql Query statement: multi-table joint query, how to limit the specific where limit or limit if the table on the right has a corresponding record, otherwise, no restrictions are imposed, such as table 6 joint queries.
MySQL page is relatively simple, only need limit offset,length can get data, but when the offset and length is larger, MySQL significantly degraded performance
1. Sub-Query optimization method
The first piece of data, then the ID that is greater
How to use MySQL to sort query results and limit the number of returned results,
Sorting of MySQL Order By query resultsORDERThe order by keyword in SQL syntax is used to sort the query results.Sorting is divided into two types: Ascending ORDER (ASC)
Use the Limit parameter to optimize MySQL queries. I read a program written by a foreigner a few days ago and used a lot of Limit keywords in MySQL queries. this made me very interested, because I was impressed, the Limit keyword seems to be more
Order bySort by field value, default ascending (ASC). The collation rule determines the sort relationship.order by 字段 升序|降序(asc|desc),Order by allows multiple fields to be sorted.Refers to the first field ordered, if not distinguished, the second
the solution for which limit and in cannot be used concurrently in MySQL.Category: MySQL2011-10-31 13:53 1277 people read comments (0) favorite reports Mysqlsubquery MySQL5.1 Neutron query cannot use limit, error: "This version of the MySQL
MySQL limit query optimization bitsCN.com
MySQL limit query optimization the following articles mainly introduce the specific content of MySQL limit query optimization. we all know that MySQL database optimization is very important. Limit is the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.